<template>
    <div v-show="homeStore.show">
        <Header v-if="homeStore.isMobile() === 'false'" />
        <slot />
        <Footer />
    </div>
</template>
<script setup>
import useStore from '@/stores'
import { onMounted } from 'vue'
import 'normalize.css/normalize.css'

const { homeStore } = useStore()

useHead({
    title: homeStore.seo.title,
    viewport: 'width=device-width, initial-scale=1, maximum-scale=1',
    charset: 'utf-8',
    meta: [
        { name: 'Description', content: homeStore.seo.desc },
        { name: 'Keywords', content: homeStore.seo.kwd }
    ],
    link: [
        {
            rel: 'icon',
            href: 'https://static.leiting.com/images/common/favicon.ico'
        }
    ],
    script: [
        {
            src: 'https://static.leiting.com/lib/common/pre_embed.js'
        },
        {
            src: 'https://static.leiting.com/lib/comRem.js'
        },
        {
            src: 'https://static.leiting.com/lib/jquery.js',
            body: true
        },
        {
            src: 'https://static.leiting.com/lib/top_bar.js',
            body: true
        },
        {
            src: 'https://static.leiting.com/lib/footer.js',
            body: true
        },
        {
            src: 'https://res2.wx.qq.com/open/js/jweixin-1.4.0.js',
            body: true
        },
        {
            src: 'https://game.leiting.com/static/common/js/wechat.js',
            body: true
        }
    ],
    bodyAttrs: {
        class: 'body-class'
    }
})
onMounted(() => {
    const myWindow = window
    if(homeStore.isMobile() === 'false') myWindow.LTRem.setSize(1920) // 调用外部脚本中的方法
    myWindow.LTFooter.init()
    if (!share_opts) {
        // 分享配置
        var share_opts = {
            title: '雷霆游戏平台 - 游戏发烧友的聚集地！',
            desc: '真正有趣好玩的游戏都在这里',
            img: homeStore.seo.imgIcon,
            url: location.href.split('#')[0],
            key: 'game_home'
        }
    }
    myWindow.weixin_jssdk_ops.init(share_opts)
})
</script>

